/**
 * Copyright (c) 2020 - present, Inspur Genersoft Co., Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import { templateRef } from '@vueuse/core';
import { CSSProperties, ExtractPropTypes, ref } from 'vue';
import { createPropsResolver } from '../../dynamic-resolver';
import clipboardSchema from './schema/clipboard.schema.json';
import { schemaMapper } from './schema/schema-mapper';

export const clipboardProps = {

    /** 是否自动完成 */
    motion: { Type: String, default: 'copy' },

    /** 组件值 */
    modelValue: { type: String, default: '' },

    /** 自定义CLASS */
    className: { Type: String, default: '' },

    /** 大小 */
    size: { Type: String, default: 'middle' },

    /** 文本 */
    text: { Type: String, default: '' },

    /** 禁用 */
    disabled: { Type: Boolean, default: false },

    /** 自定义图标 */
    iconClass: { Type: String, default: '' },

    /** 样式 */
    style: { Type: ref<CSSProperties>, default: '' },

    /** 复制目标元素 */
    target:{ Type: templateRef<any>, default: ref<HTMLElement | null>(null) }

} as Record<string, any>;

export type ClipboardProps = ExtractPropTypes<typeof clipboardProps>;

export const propsResolver = createPropsResolver<ClipboardProps>(clipboardProps, clipboardSchema, schemaMapper);
